<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠年有好礼，准了送惊喜</title>
    <script src="{$oss}/active/newyear/js/rem.js"></script>
    <link rel="stylesheet" href="{$oss}/active/newyear/css/style.css">
    <meta name="description" content="财富报告，年度报告……免费抢！">
    <script src="https://static.mlinks.cc/scripts/dist/mlink.min.js"></script>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
</head>
<body>
<div class="content">
    <div class="img-item">
        <img src="{$oss}/active/newyear/img/h1.png" alt="">
        <img src="{$oss}/active/newyear/img/h2.png" alt="">
        <img src="{$oss}/active/newyear/img/h3.png" alt="">
    </div>
    <!--    内容-->
    <div class="item-box">
        <div style="width: 7.5rem;height: 1.29rem;overflow: hidden">
            <div class="item-sel-box-x" style="width: 7.5rem;height: 1.4rem;overflow-y: auto">
                <div class="item-sel-box">
                    <div class="sel-item sel-item30-{$data[24]['status']==3?'1':'2'} {$index==24?'show':''}" data-index="24"
                         style="margin-left: 0"></div>
                    <div class="sel-item  sel-item1-{$data[25]['status']==3?'1':'2'} {$index==25?'show':''}" data-index="25"></div>
                    <div class="sel-item  sel-item2-{$data[26]['status']==3?'1':'2'} {$index==26?'show':''}" data-index="26"></div>
                    <div class="sel-item  sel-item3-{$data[27]['status']==3?'1':'2'} {$index==27?'show':''}" data-index="27"></div>
                    <div class="sel-item  sel-item4-{$data[28]['status']==3?'1':'2'} {$index==28?'show':''}" data-index="28"></div>
                    <div class="sel-item  sel-item5-{$data[29]['status']==3?'1':'2'} {$index==29?'show':''}" data-index="29"></div>
                    <div class="sel-item  sel-item7-{$data[31]['status']==3?'1':'2'} {$index==31?'show':''}" data-index="31"></div>
                </div>
            </div>
        </div>
        <div class="content-box">
            {if $record}
            <div class="tip-box">
                <div class="tip-content-box">
                    {foreach name='record'  item='v'}
                    <div class="tip-item">
                        <img src="{$v.avatar}" alt="">
                        <span>{$v.nickname}抢到"{$v.cname}"</span>
                    </div>
                    {/foreach}
                    <div class="tip-item">
                        <img src="{$record[0]['avatar']}" alt="">
                        <span>{$record[0]['nickname']}抢到"{$record[0]['cname']}"</span>
                    </div>
                </div>
            </div>
            {/if}
            <div class="content-item  {$index==24?'show':''}" data-index="24" data-dt="1">
                <div class="status-box">
                    <img class="bg" src="{$oss}/active/newyear/img/status{$data[24]['status']}.png" alt="">
                    <img class="name" src="{$oss}/active/newyear/img/good-day30.png" alt="">
                </div>
                <div class="good-box">
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon1.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">财富报告免费解锁券</p>
                            <p class="num">仅{$data[24]['a2_num']}个名额</p>
                        </div>
                        <div class="good-button">
                            <a class="activ2-s{$data[24]['b2_status']} a1 {$index==24?'index-btn':''}" href="javascript:;">{$data[24]['b2_name']}</a>
                        </div>
                    </div>
                    <div class="good-item1">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon2.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">财富报告9折券</p>
                            <p class="num">还剩{$data[24]['a1_num']}份</p>
                        </div>
                        <div class="good-button">
                            <a class="activ1-s{$data[24]['b1_status']} a2 {$index==24?'index-btn':''}" href="javascript:;">{$data[24]['b1_name']}</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content-item  {$index==25?'show':''}" data-index="25" data-dt="2">
                <div class="status-box">
                    <img class="bg" src="{$oss}/active/newyear/img/status{$data[25]['status']}.png" alt="">
                    <img class="name" src="{$oss}/active/newyear/img/good-day1.png" alt="">
                </div>
                <div class="good-box">
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon1.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name" style="font-size: 0.27rem">2020年度报告免费解锁</p>
                            <p class="num">仅{$data[25]['a2_num']}个名额</p>
                        </div>
                        <div class="good-button">
                            <a class="activ2-s{$data[25]['b2_status']} a1 {$index==25?'index-btn':''}" href="javascript:;">{$data[25]['b2_name']}</a>
                        </div>
                    </div>
                    <div class="good-item1">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon2.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">2020年度报告9折券</p>
                            <p class="num">还剩{$data[25]['a1_num']}份</p>
                        </div>
                        <div class="good-button">
                            <a class="activ1-s{$data[25]['b1_status']} a2 {$index==25?'index-btn':''}" href="javascript:;">{$data[25]['b1_name']}</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content-item  {$index==26?'show':''}" data-index="26" data-dt="3">
                <div class="status-box">
                    <img class="bg" src="{$oss}/active/newyear/img/status{$data[26]['status']}.png" alt="">
                    <img class="name" src="{$oss}/active/newyear/img/good-day2.png" alt="">
                </div>
                <div class="good-box">
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon1.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">月度报告免费解锁券</p>
                            <p class="num">仅{$data[26]['a2_num']}个名额</p>
                        </div>
                        <div class="good-button">
                            <a class="activ2-s{$data[26]['b2_status']}  a1 {$index==26?'index-btn':''}" href="javascript:;">{$data[26]['b2_name']}</a>
                        </div>
                    </div>
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon2.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">月度报告解锁8折券</p>
                            <p class="num">还剩{$data[26]['a1_num']}份</p>
                        </div>
                        <div class="good-button">
                            <a class="activ1-s{$data[26]['b1_status']}  a2 {$index==26?'index-btn':''}" href="javascript:;">{$data[26]['b1_name']}</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content-item {$index==27?'show':''}" data-index="27" data-dt="4">
                <div class="status-box">
                    <img class="bg" src="{$oss}/active/newyear/img/status{$data[27]['status']}.png" alt="">
                    <img class="name" src="{$oss}/active/newyear/img/good-day3.png" alt="">
                </div>
                <div class="good-box">
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon1.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">校准生辰免费券</p>
                            <p class="num">仅{$data[27]['a2_num']}个名额</p>
                        </div>
                        <div class="good-button">
                            <a class="activ2-s{$data[27]['b2_status']} a1 {$index==27?'index-btn':''}" href="javascript:;">{$data[27]['b2_name']}</a>
                        </div>
                    </div>
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon2.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">校准生辰8折券</p>
                            <p class="num">还剩{$data[27]['a1_num']}份</p>
                        </div>
                        <div class="good-button">
                            <a class="activ1-s{$data[27]['b1_status']} a2 {$index==27?'index-btn':''}" href="javascript:;">{$data[27]['b1_name']}</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content-item {$index==28?'show':''}" data-index="28" data-dt="5">
                <div class="status-box">
                    <img class="bg" src="{$oss}/active/newyear/img/status{$data[28]['status']}.png" alt="">
                    <img class="name" src="{$oss}/active/newyear/img/good-day4.png" alt="">
                </div>
                <div class="good-box">
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon1.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">日运全年免费解锁</p>
                            <p class="num">仅{$data[28]['a2_num']}个名额</p>
                        </div>
                        <div class="good-button">
                            <a class="activ2-s{$data[28]['b2_status']} a1 {$index==28?'index-btn':''}" href="javascript:;">{$data[28]['b2_name']}</a>
                        </div>
                    </div>
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon2.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">日运全年解锁8折券</p>
                            <p class="num">还剩{$data[28]['a1_num']}份</p>
                        </div>
                        <div class="good-button">
                            <a class="activ1-s{$data[28]['b1_status']} a2 {$index==28?'index-btn':''}" href="javascript:;">{$data[28]['b1_name']}</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content-item {$index==29?'show':''}" data-index="29" data-dt="6">
                <div class="status-box">
                    <img class="bg" src="{$oss}/active/newyear/img/status{$data[29]['status']}.png" alt="">
                    <img class="name" src="{$oss}/active/newyear/img/good-day5.png" alt="">
                </div>
                <div class="good-box">
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon1.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">幸运之城打包免费解锁</p>
                            <p class="num">仅{$data[29]['a2_num']}个名额</p>
                        </div>
                        <div class="good-button">
                            <a class="activ2-s{$data[29]['b2_status']} a1 {$index==29?'index-btn':''}" href="javascript:;">{$data[29]['b2_name']}</a>
                        </div>
                    </div>
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon2.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">幸运之城打包8折解锁</p>
                            <p class="num">还剩{$data[29]['a1_num']}份</p>
                        </div>
                        <div class="good-button">
                            <a class="activ1-s{$data[29]['b1_status']} a2 {$index==29?'index-btn':''}" href="javascript:;">{$data[29]['b1_name']}</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content-item {$index==31?'show':''}" data-index="31" data-dt="8">
                <div class="status-box">
                    <img class="bg" src="{$oss}/active/newyear/img/status{$data[31]['status']}.png" alt="">
                    <img class="name" src="{$oss}/active/newyear/img/good-day7.png" alt="">
                </div>
                <div class="good-box">
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon1.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">会员免费解锁券</p>
                            <p class="num">仅{$data[31]['a2_num']}个名额</p>
                        </div>
                        <div class="good-button">
                            <a class="activ2-s{$data[31]['b2_status']} a1 {$index==31?'index-btn':''}" href="javascript:;">{$data[31]['b2_name']}</a>
                        </div>
                    </div>
                    <div class="good-item">
                        <div class="good-icon">
                            <img src="{$oss}/active/newyear/img/good-icon2.png" alt="">
                        </div>
                        <div class="good-name">
                            <p class="name">会员解锁8折券</p>
                            <p class="num">还剩{$data[31]['a1_num']}份</p>
                        </div>
                        <div class="good-button">
                            <a class="activ1-s{$data[31]['b1_status']} a2 {$index==31?'index-btn':''}" href="javascript:;">{$data[31]['b1_name']}</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--    使用规则标签-->
    <div class="rule-icon">
        <img src="{$oss}/active/newyear/img/rule-icon.png" alt="">
    </div>
    <!--    使用规则详情-->
    <div class="rule-box">
        <div class="cover"></div>
        <div class="rule-content">
            <div class="rule-info">
                <img class="rile-title" src="{$oss}/active/newyear/img/rule-title.png" alt="" style="margin-bottom: 0.2rem">
                <div class="rule-item">
                    <p class="p1">（1）</p>
                    <p class="p-content">本活动仅限准了APP用户参与，从除夕至初七，用户 每天最多可领取两份优惠券福利，均为限量发售。</p>
                </div>
                <div class="rule-item">
                    <p class="p1">（2）</p>
                    <p class="p-content">领取到的优惠券，需按照优惠券规则范围内进行使用。</p>
                </div>
                <div class="rule-item">
                    <p class="p1">（3）</p>
                    <p class="p-content">优惠券领取时间见下表</p>
                </div>
                <img class="ru-if" src="{$oss}/active/newyear/img/rule-info.png" alt="">
                <div class="rule-item">
                    <p class="p1">（4）</p>
                    <p class="p-content">优惠券不得拆分，不得转赠或者售卖。</p>
                </div>
                <div class="rule-item">
                    <p class="p1">（5）</p>
                    <p class="p-content">优惠仅限在有效期内进行使用，逾期作废。</p>
                </div>
                <div class="rule-item">
                    <p class="p1">（6）</p>
                    <p class="p-content">优惠券不可兑换、不找零、不可兑现，每个订单最多可使用一张优惠券。不能叠加使用。</p>
                </div>
                <div class="rule-item">
                    <p class="p1">（7）</p>
                    <p class="p-content">在获取和使用优惠券过程中，如果出现违规行为（包含但不限于：作弊领取、恶意盗刷、恶意套现等）准了将有权采取终止违规交易、追回不当利益、废除未使用优惠券等措施。</p>
                </div>
                <div class="rule-item">
                    <p class="p1">（8）</p>
                    <p class="p-content">最终解释权归北京准了科技有限公司所有。</p>
                </div>
            </div>
            <div class="close-box"><img src="{$oss}/active/newyear/img/close.png" alt=""></div>
        </div>
    </div>
</div>
<div class="message-box">
    <div class="message"></div>
</div>
<div class="share-box">
    <img src="{$oss}/active/newyear/img/share.png" alt="">
</div>
</body>
<script type="text/javascript" src="{$oss}/active/newyear/js/jquery-v2.1.1.min.js"></script>
<script type="text/javascript">
    $(function () {
        var index = {$index};
        function tipReload(herght, index, num, time) {
            if (num < 1) {
                return;
            }
            if (index > 0) {
                $('.tip-content-box').animate({top: '-' + (herght * index) + 'px'}, 700);
                if (index == num) {
                    setTimeout(function () {
                        $('.tip-content-box').css({top: '0px'});
                    }, 750);
                    index = 0;
                }
            }
            index++;
            setTimeout(function () {
                tipReload(herght, index, num, time)
            }, time)
        }

        tipReload($('.tip-item').height(), 0, {$recordLen}, 5000);
        $('.rule-icon').click(function () {
            $('.rule-box').show();
        });
        $('.close-box img').click(function () {
            $('.rule-box').hide();
        });

        var btnSta1 = {$data[$index]['b1_status']};
        var btnTime1 = {$data[$index]['a1_time']};
        var btnSta2 = {$data[$index]['b2_status']};
        var btnTime2 = {$data[$index]['a2_time']};

        if (btnSta1 == 2) {
            btn1Times(btnTime1)
        }
        if (btnSta2 == 7) {
            setInterval(function () {
                btnTime2--;
            },1000)
        }

        function btn1Times(times) {
            if (times <= 0) {
                $('.activ1-s2.index-btn').removeClass('activ1-s2').addClass('activ1-s3').text('立即抢');
                return;
            }
            var hour = Math.floor(times / 3600);
            var minute = Math.floor((times - hour * 3600) / 60);
            var second = times - hour * 3600 - minute * 60;

            var dates = dataLeftCompleting(hour) + ':' + dataLeftCompleting(minute) + ':' + dataLeftCompleting(second) + '后开抢';
            $('.activ1-s2.index-btn').text(dates);
            times--;
            setTimeout(function () {
                btn1Times(times)
            }, 1000);
        }

        function dataLeftCompleting(value) {
            return parseInt(value) < 10 ? "0" + value.toString() : value;
        }

        function btn2Times(times) {
            if (times <= 0) {
                $('.activ2-s2.index-btn').removeClass('activ2-s2').addClass('activ2-s3').text('立即抢');
                return;
            }
            var hour = Math.floor(times / 3600);
            var minute = Math.floor((times - hour * 3600) / 60);
            var second = times - hour * 3600 - minute * 60;
            var dates = dataLeftCompleting(hour) + ':' + dataLeftCompleting(minute) + ':' + dataLeftCompleting(second) + '后开抢';
            $('.activ2-s2.index-btn').text(dates);
            times--;
            setTimeout(function () {
                btn2Times(times)
            }, 1000);
        }
        var  status = {$login};
        var aa1 = 1;
        var isUpdate = {$isUpdate};
        $(document).on('click', '.activ1-s3.index-btn', function () {
            if (status != 1) return;
            if(isUpdate == 1){
                message('您的当前版本较低，需要更新至更高版本才可以参与活动哦~');
                return;
            }
            if (aa1 == 2) return;
            aa1 = 2;
            var that = $(this);
            var index = $(this).parents('.content-item').data('dt');
            $.ajax({
                url: '/api/v14/new_year_active1?dt=' + index,
                type: 'GET',
                dataType: 'json',
                headers: {$headers},
                success: function (res) {
                    if (res.code == 200) {
                        that.removeClass('activ1-s3').addClass('activ1-s5').text('已领取');
                    }
                    setTimeout(function () {
                        aa1 = 1;
                    }, 1500);
                    message(res.msg);
                }
            });
        });
        var aa2 = 1;
        $(document).on('click', '.activ2-s3.index-btn', function () {
            if (status != 1) return;
            if(isUpdate == 1){
                message('您的当前版本较低，需要更新至更高版本才可以参与活动哦~');
                return;
            }
            if (aa2 == 2) return;
            aa2 = 2;
            var that = $(this);
            var index = $(this).parents('.content-item').data('dt');
            $.ajax({
                url: '/api/v14/new_year_active2?dt=' + index,
                type: 'GET',
                dataType: 'json',
                headers: {$headers},
                success: function (res) {
                    if (res.code == 200) {
                        that.removeClass('activ2-s3').addClass('activ2-s5').text('已领取');
                    }
                    setTimeout(function () {
                        aa2 = 1;
                    }, 1500);
                    message(res.msg);
                }
            });
        });
        var k = 1;
        $(document).on('click', '.activ2-s7.index-btn', function () {
            if (status != 1) return;
            if(isUpdate == 1){
                message('您的当前版本较低，需要更新至更高版本才可以参与活动哦~');
                return;
            }
            if (k == 2) return;
            k = 2;
            // 分享抢
            var that = $(this);
            set('share'+index,true);
            $('.share-box').show();
            setTimeout(function () {
                k = 1;
                $('.share-box').hide();
                if(btnTime2 > 0){
                    that.removeClass('activ2-s7').addClass('activ2-s2');
                    btn2Times(btnTime2);
                }else {
                    that.removeClass('activ2-s7').addClass('activ2-s3').text('立即抢');
                }
            }, 5000);
        });

        setTimeout(function () {
            var isShare = get('share' + index) || false;
            if (isShare) {
                $('.activ2-s7.index-btn').removeClass('activ2-s7').addClass('activ2-s2');
                btn2Times(btnTime2);
            }
        },200);

        {if !$login}
        new Mlink([{
            mlink:'https://axelkv.mlinks.cc/AesI',//跳转至APP首页
            button:document.querySelector('a.index-btn.a1')
        },{
            mlink:'https://axelkv.mlinks.cc/AesI',//跳转至APP首页
            button:document.querySelector('a.index-btn.a2')
        }]);
        {/if}


        $('.sel-item').click(function () {
            var index = $(this).data('index');
            $('.content-item').removeClass('show');
            $('.content-item[data-index=' + index + ']').addClass('show');
            $(this).addClass('show').siblings('.sel-item').removeClass('show');
        });

        if(index > 27){
            $('.item-sel-box-x').scrollLeft(1000);
        }

        function message(text) {
            $('.message').text(text);
            $('.message-box').show();
            setTimeout(function () {
                $('.message-box').hide();
            }, 2500);
        }
        wx.config({
            debug: false,
            appId: '{$signPackage.appId}',
            timestamp: {$signPackage.timestamp},
            nonceStr: '{$signPackage.nonceStr}',
            signature: '{$signPackage.signature}',
            jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage']
        });
        wx.ready(function(){
            wx.onMenuShareAppMessage({
                title: '鼠年有好礼，准了送惊喜', // 分享标题
                desc: '财富报告，年度报告……免费抢！', // 分享描述
                link: '{$signPackage.url}', // 分享链接
                imgUrl: 'https://oss.goddessxzns.com/picture/uploads/logo.png?x-oss-process=style/show', // 分享图标
                type: 'link', // 分享类型,music、video或link，不填默认为link
                dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
            wx.onMenuShareTimeline({
                title: '鼠年有好礼，准了送惊喜', // 分享标题
                link: '{$signPackage.url}', // 分享链接$signPackage.url
                imgUrl: 'https://oss.goddessxzns.com/picture/uploads/logo.png?x-oss-process=style/show', // 分享图标
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
        });

        function set(key,value){
            localStorage.setItem(key,value);//转换成json字符串序列
        }
        function get(key)//exp是设置的过期时间
        {
            var val = localStorage.getItem(key);//获取存储的元素
            return  val;
        }
    })
</script>
{include file="../apps/web/view/public/sensors.html" /}
</html>
